<template>
  <div  class="avatar" v-html="getAvatar()" />
</template>
<script setup>
//  像素块avatar  @dicebear/avatars 是一个集合包，随机生成图标。有多种风格如 identicon、jdenticon的图标
import {createAvatar} from "@dicebear/avatars";
import * as style from "@dicebear/avatars-male-sprites";
const props = defineProps({
  avatarName:{
    type:String,
    default:''
  }
})

const getAvatar = ()=>{
  return  createAvatar(style,{
    seed: props.avatarName,
  });
}

</script>


